home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 315 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: sundog.tiac.net!stanr
  2. From: stanr@tiac.net (Stan Ryckman)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Question on 'getopt'
  5. Date: 7 Feb 1996 03:49:16 GMT
  6. Organization: Amber & Sneakers Fan Club
  7. Message-ID: <4f97fs$s47@sundog.tiac.net>
  8. References: <1996Feb5.225706.10082@tmai.com>
  9. NNTP-Posting-Host: sunspot.tiac.net
  10.  
  11. In article <1996Feb5.225706.10082@tmai.com>,
  12. Sridhar Panchapakesan  <sridharp> wrote:
  13. :This is a multi-part message in MIME format.
  14.  
  15. If you can avoid posting in MIME, please do so.  Some can't read it.
  16. Also, your post doesn't have a replyable email address.  Seems like
  17. you could use some new software.
  18.  
  19. [snip]
  20.  
  21. :I am trying to use 'getopt' to read a quoted string as options for a
  22. :program. It works fine when I try it from a shell (csh) but when I try
  23. :running it from a script using 'exec' it does not accept the entire the
  24. :entire quoted string as the option.
  25. :
  26. :e.g. ( test is the program name)
  27. :% test -f "-g -o 5" in.txt
  28. :( getopt works fine. The string "-g -o 5" is read correctly into
  29. :optargs. Note that I have to use '-' (dash) in the string as a
  30. :requirement of the program itself.)
  31. :
  32. :However when I try it from the script file:
  33. :
  34. :exec test -f "\"-g -o 5\"" in.txt
  35. :
  36. :The getopt only recognizes "-g as the option for -f instead of "-g -o
  37. :5".
  38. :
  39. :I would appreciate any help in this area..
  40.  
  41. Well, since it works fine in the first case, you don't seem to have a
  42. C problem but rather a shell problem.  Maybe you couldn't tell that,
  43. so I won't flame you.  (This time :-)
  44.  
  45. I would suggest you try comp.unix.shell.  Also, give them the
  46. results of the "uname -a" command in case it's a system-related thing.
  47. Other: they will probably tell you to use sh scripts, not csh, because
  48. csh is buggy.  They will be right.  Also, try to use some other name
  49. than "test" since "test" is a UNIX command and that possibility adds
  50. to the confusion.
  51.  
  52. Good luck.  Now back to C standards issues (we hope).
  53.  
  54. Cheers,
  55. Stan.
  56. --
  57. Stan Ryckman  (stanr@tiac.net) (new e-mail address)
  58.